using UnityEngine;
using UnityEngine.UI;

public class ProcessSlider : MonoBehaviour
{
    Slider m_Slider;
    GameObject m_BindObj;
    private void Awake()
    {
        m_Slider = GetComponent<Slider>();
    }
    void Start()
    {

    }
    private void OnEnable()
    {
        transform.SetParent(GameObject.Find("ProcessPanel").transform);
    }

    // Update is called once per frame
    void Update()
    {
        if (m_BindObj)
        {
            var screenPoint = Camera.main.WorldToScreenPoint(m_BindObj.transform.position);
            transform.position = screenPoint;
        }
    }
    public void SetProcess(float process)
    {
        m_Slider.value = process;
    }

    public void Bind(GameObject target)
    {
        m_BindObj = target;
    }
}
